﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Aragorn.SOA.Infratructure;
using Aragorn.SOA.Infratructure.Interface;
using Aragorn.SOA.Infratructure;
using Aragorn.SOA.Infratructure.Interface;
using ZooKeeperNet;

namespace Aragorn.ZK.Client
{
    class Program
    {

        public static IZooKeeper zk;


        static void Main(string[] args)
        {
            ServicesMeta meta = new ServicesMeta()
            {
                Address = "127.0.0.1",
                type=ServicesType.Basic_Platform,
                Description = @"this is a test client",
                Level = 0,
                Port = 9090,
                TrackID = Guid.NewGuid().ToString(),
                ServicesName = "Wcfprovider"
            };

            ServicesProxy proxy = new ServicesProxy();


            proxy.Register(meta);

            Console.WriteLine("#############################################");


            //ServicesDiscovery dy = new ServicesDiscovery();
            //dy.Init();

            //dy.SelectAllRepository();

            Console.ReadKey();

            //var zk = new ZooKeeper("192.168.1.126:2181", new TimeSpan(1, 0, 0), null);

            //Thread.Sleep(1000);

            //Console.WriteLine("zookeeper连接成功。" + zk.State);


            //if (zk.Exists("/data", false) == null)
            //    zk.Create("/data", "公司节点".GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);

            //Console.WriteLine("/data 节点创建成功");

            //if (zk.Exists("/data/services",false)==null)
            //    zk.Create("/data/services", "服务分类".GetBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.Persistent);
            //Console.WriteLine("/data/servers 节点创建成功");



        }
    }
}
